package com.rabbiter.ordering.mapper;

import com.rabbiter.ordering.entity.Foods;
import com.rabbiter.ordering.entity.Params;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FoodsMapper {

    // @Select("select * from foods where name = #{username}")
    // User selectByUsername(String username);

    void insert(Foods foods);

    void deleteById(Integer id);

    void updateById(Foods foods);

    List<Foods> findAll(@Param("params")Params params);

    @Select("select * from foods where id =#{id}")
    Foods selectById(Integer id);

    @Select("select t.*,t1.name as cateName from foods t left join dish_category t1 on t.cateid = t1.id order by t.id desc")
    List<Foods> selectAll();
}
